package com.tengju.user.domain.model.login;

import com.tengju.user.domain.model.user.StaffId;
import com.tengju.user.domain.model.user.UserId;
import com.tengju.user.domain.shared.IdObject;
import lombok.ToString;
import lombok.Value;

/**
 * @author wuziyang
 */
@Value
@ToString
public class LogoutInfo {

    private String token;

    private UserId userId;

    private StaffId staffId;

    private UserType userType;

    public boolean validId(IdObject idObject, UserType userType) {

        if (userType == UserType.USER) {
            return this.userId.getValue() == idObject.getValue() && this.userType == userType;
        } else if (userType == UserType.STAFF) {
            return this.staffId.getValue() == idObject.getValue() && this.userType == userType;
        }
        return false;

    }

}
